package com.yxjx.duoxue.datamodel;

import java.io.Serializable;

import org.json.JSONException;
import org.json.JSONObject;

import com.yxjx.duoxue.utils.UIHelper;

public class DMReportErrorItem extends DMObject implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -8217766495208965324L;
	
	private int id;
	private String name;
	private String des;
	private boolean selected;// 选择时使用
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getDes() {
		return des;
	}
	public void setDes(String des) {
		this.des = des;
	}

	public static DMReportErrorItem from(String str) {
		if (UIHelper.isEmpty(str)) {
			return null;
		}
		try {
			DMReportErrorItem item = new DMReportErrorItem();
			JSONObject jo = new JSONObject(str);
			item.setId(castInteger(jo,"id"));
			item.setDes(castString(jo,"des"));
			item.setName(castString(jo,"name"));
			return item;
		} catch (JSONException e) {
			e.printStackTrace();
			return null;
		}
	}
	
	@Override
	public String toString() {
		return "DMReprotErrorItem id = " + id + ", name = " + name + ", des = " + des;
	}
	public boolean isSelected() {
		return selected;
	}
	public void setSelected(boolean selected) {
		this.selected = selected;
	}
}
